<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type="text/javascript" src="../amcolumn/swfobject.js"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<script type="text/javascript">
		function goExport(form){
		  if (!$('#selCreateUser').val()){
		     $('#selCreateUserId').val("");
		  }
		  if (!$('#start').val()&&!$('#end').val()&&!$('#selMarketingPlanId').val()){
		    alert("full choice ");
		    return;
		  }
        	$('#listForm').submit();
		}
		function goExportLeader(form){
		  if (!$('#selCreateUser').val()){
		     $('#selCreateUserId').val("");
		  }
		  if (!$('#start').val()&&!$('#end').val()&&!$('#selMarketingPlanId').val()){
		    alert("full choice ");
		    return;
		  }
		      var t=$('#listForm');
              t.attr('action',t.attr('action').replace('exportPte','exportPteLeader'));
              $('#listForm').submit();
              t.attr('action',t.attr('action').replace('exportPteLeader','exportPte'));
		}
		$(function(){
			$('#start').datepicker({dateFormat:'yy-mm-dd',
			             changeMonth: true,
			             changeYear: true});
			$('#end').datepicker({dateFormat:'yy-mm-dd',
			             changeMonth: true,
			             changeYear: true});
		    $("#selMarketingPlan").autocomplete("<s:url value="/marketing/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selMarketingPlan").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selMarketingPlanId").val(d.id);
            });
             $("#selCreateUser").autocomplete("<s:url value="/system/User/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name+" "+d.wno;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name+" "+d.wno;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selCreateUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCreateUserId").val(d.id);
            });
		});
</script>
		<title><s:text name="system.title" /></title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="PteExport/exportPte" name="listForm" id="listForm"
						namespace="/report">
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
									<s:date name="start" format="yyyy-MM-dd" var="xx" />
									<s:date name="end" format="yyyy-MM-dd" var="x2" />
									Marketing Time From:
									<s:textfield name="start" id="start" cssClass="input2"
										size="10" value="%{xx}"
										onFocus="$('#flashMode').hide();$('#tableMode').show();$('#mode').attr('checked',false)" />
									&nbsp;&nbsp;To:
									<s:textfield value="%{x2}" name="end" id="end"
										cssClass="input2" size="10"
										onFocus="$('#flashMode').hide();$('#tableMode').show();$('#mode').attr('checked',false)" />
							 		<s:textfield id="selMarketingPlan" name="marketingPlanname"  
										cssClass="input2" size="20" />
									<s:hidden id="selMarketingPlanId" name="selMarketingPlanId" />
									&nbsp;CreateUser:
									<s:textfield  id="selCreateUser" name="selCreateUser" cssClass="input2" size="10" /> 
									<s:hidden id="selCreateUserId" name="selCreateUserId"/>
									<input type="button" value="PTE"   
									     onClick="goExport(this.form);"
										src="<s:url value="/img/right/Export.gif"/>" border="0"
										align="absmiddle" />
									<input type="button" value="Team Leader"   
									     onClick="goExportLeader(this.form);"
										src="<s:url value="/img/right/Export.gif"/>" border="0"
										align="absmiddle" />
								</td>
							</tr>
						</table>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>